package com.dcw.lixb.designmode.visitor;

/**
 * @author lixiaobin
 * @date 2020-07-29 16:11:59
 * @desc 描述信息
 */
public class Computer implements ComputerPart {

    ComputerPart[] mComputerParts;

    public Computer() {
        mComputerParts = new ComputerPart[]{new Mouse(),new Keyboard(),new Monitor()};
    }

    @Override
    public void accept(ComputerPartVisitor visitor) {
        for (int i = 0; i < mComputerParts.length; i++) {
            mComputerParts[i].accept(visitor);
        }
        visitor.visit(this);
    }
}
